<?php
namespace Home\Model;
use Think\Model;
class AccountModel extends Model {
	
	public function account_list($pageNo,$pageSize,$where="1")
	{    
		
		 $user=M('account');
		 $count['count']=$user->where($where)->count();
		 $count['countpage']=ceil($count['count']/$pageSize);
		 
		 if($pageNo>=$count['countpage']){
			$pageNo=$count['countpage'];
		 }
		 if($pageNo<=0){
		 	$pageNo=1;
		 }
		 
		 $account_list=$user->field('id,username')->where($where)->limit(($pageNo-1)*$pageSize,$pageSize)->select();
		 
		 $count['pageSize']=$pageSize;
		 $count['pageNo']=$pageNo;
		 $count['num']=$count['countpage']-4;
		
		 $result['account_list']=$account_list;
		 $result['count']=$count;
		 $result['data']=$data;
		 return $result;
		 
	}
	
    public function user_info_id($id)
	{
		 
		 $user=M('user_list');
		 
		 $userinfo=$user->field('id,username,type,password')->where('id='.$id)->find();
	
		 return $userinfo;
	}
	

	
}
?>